/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Viewer.java
 *
 * Created on Jan 23, 2009, 8:44:12 AM
 */

package com.viewer;

import java.util.ArrayList;
import java.util.Date;

/**
 *
 * @author Administrator
 */
public class Viewer extends javax.swing.JFrame {

    String viewText = "<html>";
    /** Creates new form Viewer */
    public Viewer() {
        initComponents();
        createTable();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jScrollPane1.setViewportView(jTable1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1000, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(198, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Viewer().setVisible(true);
            }
        });
    }

    public void updateText(int claimID, String startAddress, String startGeoPoint, String endAddress, String endGeoPoint, String distance, String username){
        model.addRow(new Object[]{claimID, username, startAddress, startGeoPoint, endAddress, endGeoPoint, distance, new Date().toString()});
        //viewText += text;
        //jLabel1.setText(viewText);
        //jTable1.s
    }
    public void createTable(){
        ArrayList<String> titles = new ArrayList<String>();
        titles.add("Claim ID");
        titles.add("UserName");
        titles.add("Start Address");
        titles.add("Start GeoPoint");
        titles.add("End Address");
        titles.add("End GeoPoint");
        titles.add("Distance");
        //titles.add("Password");
        titles.add("Received Date");
        model = new ListTableModel(titles);
        jTable1.setModel(model);
    }
    
    ListTableModel model;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables

}
